Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Dockerfile and .dockerignore for containerization #508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Adesoji1
Copy link

Title: feat: add Docker support with Dockerfile and .dockerignore

Summary

This PR introduces Docker support for the Audiocraft project by adding a Dockerfile and a .dockerignore file. These additions facilitate containerization, enabling easier deployment and environment consistency across different systems.

Changes Made

  1. Dockerfile:

    • Utilizes NVIDIA's CUDA base image with Python 3.9 and cuDNN 8 for GPU acceleration.
    • Installs necessary system dependencies including ffmpeg, build-essential, and git.
    • Sets up Python environment and installs project dependencies from requirements.txt.
    • Copies the project code into the Docker image.
    • Defines the default command to run the training script (train.py).
  2. .dockerignore:

    • Excludes unnecessary files and directories to optimize the Docker build context.
    • Prevents inclusion of version control files, Python artifacts, build directories, virtual environments, logs, temporary files, and large data/model directories.

Rationale

  • Consistency: Docker ensures that the application runs consistently across different environments by encapsulating all dependencies.
  • Ease of Deployment: Facilitates deploying Audiocraft on various platforms without manual environment setup.
  • Efficiency: The .dockerignore file optimizes build times and image sizes by excluding non-essential files.

How to Use

  1. Build the Docker Image:

    docker build -t audiocraft:latest .
  2. Run the Docker Container with GPU Support:

    docker run --gpus all \
      -v /path/to/your/data:/app/data \
      -v /path/to/your/models:/app/models \
      -v /path/to/your/output:/app/output \
      -e AUDIOCRAFT_CACHE_DIR=/app/cache \
      -it audiocraft:latest

Testing

  • Verified GPU accessibility within the Docker container using PyTorch.
  • Successfully ran the training script (train.py) without issues.

Future Improvements

  • Multi-Stage Builds: To further optimize image size by separating build-time and runtime dependencies.
  • Environment Variables: Enhance flexibility by parameterizing more configurations.

Kindly test the dockerfile, i await your response

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants